#pragma once

#include "Test.h"
#include "phy/ParticleEngine2D.h"

class ExplosionTest : public Test
{
public:
	ExplosionTest(TestManager* testManager);
	virtual ~ExplosionTest();

	virtual void Init();
	virtual void Update(float i_elapsedTime);
	virtual void Render(Renderer& renderer) const;
	virtual	void OnKeyPressed(int keyCode);

	void Shoot();
	void Explode(const phynet::Real i_maxRelativeSpeed);
	void ExplodeParticle(phynet::phy::Particle2D* const i_particle, const phynet::Real i_maxRelativeSpeed);

private:
	phynet::phy::ParticleEngine2D m_engine;

	phynet::phy::ParticleGravityFG2D m_gravityFG;
	phynet::phy::ParticleWindFG2D m_windFG;

	phynet::Real m_nextParticleSpeed;
	phynet::Real m_nextParticleAngleGrad;
	phynet::Real m_nextParticleDamping;
	phynet::Real m_explosionMaxSpeed;
	int m_nextParticleMaxMassUnit;

	static const phynet::Real PARTICLE_STARTING_SPEED;
	static const phynet::Real PARTICLE_STARTING_ANGLE_GRAD;
	static const phynet::Real PARTICLE_STARTING_DAMPING;
	static const phynet::Real PARTICLE_STARTING_EXPLOSION_SPEED;
	static const phynet::Real PARTICLE_MIN_FRAGMENT_MASS;
	static const int PARTICLE_STARTING_MAX_MASS_UNIT = 100;
}; // class ExplosionTest
